home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk125 / usmap / gbuttons < prev    next >
Encoding:
Text File  |  1995-03-19  |  2.4 KB  |  160 lines

  1.  
  2.     setblack 1
  3.     load 1,"usmap1"    :rem  we need a blank screen, so use something handy
  4.     pen 0,1
  5.     pen 1,0
  6.     clear
  7.     setblack 0    :rem  reveal not that screen's blank
  8.  
  9.     array 1000,2    :rem place to put data
  10.     pointer 1
  11.  
  12. 10
  13.     abort 1
  14.     clear
  15.     move 10,10
  16.     text "Mask file name?"
  17.     move 0,30
  18.     input $(0),40
  19.     if @(0)=0:end:endif        :rem  none specified
  20.  
  21.     mode=0
  22.     open mode,$(0)    :rem  try to open the file
  23.     if mode=0
  24.         move 0,50
  25.         text "Can't find file"
  26.         abort 0
  27. 5
  28.         ifkey key
  29.         ifmouse x,y
  30.         if x#-1 | key#-1:goto 10:endif
  31.         pause 1    
  32.         goto 5
  33.     endif
  34.     close
  35.  
  36.     load 2,$(0)        :rem  load the selected file
  37.     resolution 2,xmax,ymax,dep
  38.  
  39.     table=100    :rem  location of table in array
  40.     butcount=0
  41.     butsize=7    :rem  size of button entry
  42.  
  43.     abort 0
  44. 20    
  45.     display 1
  46.     clear
  47.     move 20,50
  48.     text butcount;" buttons defined"
  49.  
  50. rem  draw MORE and DONE buttons
  51.     move 10,10
  52.     draw 60,10
  53.     draw 60,30
  54.     draw 10,30
  55.     draw 10,10
  56.     move 18,24
  57.     text "MORE"
  58.     move 70,10
  59.     draw 130,10
  60.     draw 130,30
  61.     draw 70,30
  62.     draw 70,10
  63.     move 78,24
  64.     text "DONE"
  65.  
  66.     getmouse x,y
  67.  
  68.     if x>70 & y>10 & x<130 & y<30        :rem  done
  69.         mode=1
  70.         open mode,"ram:btable"    :rem  write output to this file
  71. 99
  72.         write @(table)
  73.         if @(table)#-1:table=table+1:goto 99:endif
  74.         close
  75.         end
  76.     endif
  77.  
  78.     if x>10 & y>10 & x<60 & y<30
  79.         gosub 100        :rem  more selected
  80.     endif
  81.  
  82.     goto 20
  83.  
  84.  
  85.  
  86. 100
  87.     display 2
  88.     gosub 200    :rem  get a box
  89.     display 1
  90.     clear
  91.     move 10,10
  92.     text "Now pick button color"
  93.     getmouse u,v
  94.     display 2
  95.     gosub 220    :rem   redraw the box
  96.     getmouse xc,yc        :rem  get color/fill location
  97.     gosub 220    :rem   erase the box
  98.     getpen bcolor,xc,yc        :rem  get the button color
  99.  
  100.     loc=table+butcount*butsize
  101.     @(loc)=x
  102.     @(loc+1)=y
  103.     @(loc+2)=xa
  104.     @(loc+3)=ya
  105.     @(loc+4)=bcolor
  106.     @(loc+5)=xc
  107.     @(loc+6)=yc
  108.     @(loc+butsize)=-1    :rem  end of table
  109.     butcount=butcount+1
  110.     return
  111.  
  112. rem  draw box
  113. 200
  114.     getmouse x,y
  115.     gosub 210    :rem  draw corner
  116.     getmouse xa,ya
  117.     gosub 210    :rem  erase corner
  118. 205
  119.     gosub 220    :rem  draw box
  120. 201
  121.     ifkey key
  122.     if key#-1:gosub 220:return:endif    :rem  box selected
  123.     ifmouse xb,yb
  124.     if xb=-1:pause 1:goto 201:endif
  125.  
  126.     da=(x-xb)*(x-xb)+(y-yb)*(y-yb)
  127.     db=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)
  128.  
  129.     gosub 220    :rem  erase box
  130.  
  131.     rem  replace closest click
  132.     if da<db
  133.         x=xb:y=yb
  134.     else
  135.         xa=xb:ya=yb
  136.     endif
  137.     goto 205
  138.  
  139. rem draw corner
  140. 210
  141.     drawmode 2    :rem  xor mode
  142.     move x,y
  143.     draw xmax_(x+20),y
  144.     move x,ymax_(y+1)
  145.     draw x,ymax_(y+10)
  146.     drawmode -1
  147.     return
  148.  
  149. rem draw box
  150. 220
  151.     drawmode 2    :rem  xor mode
  152.     move x,y
  153.     draw xa,y
  154.     draw xa,ya
  155.     draw x,ya
  156.     draw x,y
  157.     drawmode -1
  158.     return
  159.  
  160.